import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';

@Entity('sys_dish')
export class Dish {
    @PrimaryGeneratedColumn({ comment: '菜品ID' })
    id: number;

    @Column({ length: 50, unique: true, comment: '菜品名称' })
    dishName: string;

    @Column({ type: 'decimal', precision: 10, scale: 2, comment: '菜品价格' })
    price: number;

    @Column({ length: 200, nullable: true, comment: '菜品图片URL' })
    imageUrl: string;

    @Column({ length: 500, nullable: true, comment: '菜品描述' })
    description: string;

    @Column({ 
        type: 'tinyint',
        default: 1, 
        comment: '菜品状态(1-上架, 0-下架)' 
    })
    status: number;

    @Column({ default: 0, comment: '分类ID' })
    categoryId: number;

    @Column({ default: 0, comment: '销售量' })
    salesVolume: number;

    @Column({ length: 50, nullable: true, comment: '创建者' })
    createBy: string;

    @CreateDateColumn({ comment: '创建时间' })
    createTime: Date;

    @Column({ length: 50, nullable: true, comment: '更新者' })
    updateBy: string;

    @UpdateDateColumn({ comment: '更新时间' })
    updateTime: Date;

    @Column({ 
        type: 'tinyint',
        default: 0, 
        comment: '删除标志(0-存在, 1-删除)' 
    })
    delFlag: number;
}